package com.rpay.common.util.http.listener.strategy;

import java.net.URI;

/**
 * @author： 
 * @date： 2017/10/16
 * @desc： 匹配&端口匹配策略
 */
public class HostPortStrategy implements ListenerStrategy {

    private String host;

    private Integer port;


    public HostPortStrategy(String host,Integer port) {
        this.host = host;
        this.port = port;
    }


    @Override
    public boolean handle(URI uri) {
        if (this.host!=null && this.port!=null && uri.getHost().equals(this.host) && this.port == uri.getPort()) {
            return true;
        }
        return false;
    }
}
